package roborally;

import roborally.Exceptions.IllegalDestinationException;

/**
 * A class of walls, that extends the class placeable. Walls are obstacles on the board, through which robots can't move.
 * 
 * @version  2.90
 * @author   Michiel Ruelens & Dieter Naten
 */
public class Wall extends Placeable {

	/**
     * Initialize the new Wall.
     * 
     * @post (new this).getPlaceableType() == PlaceableType.WALL
     */
	public Wall(){
		setPlaceableType(PlaceableType.WALL);
	}
	
	/**
	 * This method puts a wall on the board on a specified position.
	 * 
	 * @param 	board
	 * 		  	The board on which the wall should be placed
	 * @param 	x
	 * 		  	The x-coordinate on which the wall should be placed
	 * @param 	y
	 * 		  	The y-coordinate on which the wall should be placed
	 * @effect  | putPlaceable(board,x,y)
	 * @throws	IllegalArgumentException()
	 * 			| if(!board.getAllObjectsByPosition(x,y).isEmpty()))
	 */
	public void putWall(Board board, long x, long y) throws IllegalArgumentException{
		if(!board.getAllObjectsByPosition(x, y).isEmpty()){
			System.out.println("There already is an object on the given position");
			throw new IllegalArgumentException();
		}
		putPlaceable(board,x,y);		
	}

	/**
	 * This method overrides the method hit in placeable. If a wall is hit, nothing should happen,
	 * so only a text is printed.
	 */
	@Override
	public void hit(){
		//NOTHING HAPPENS
		System.out.println("A wall was hit, nothing happened.");
	}
}
